/*
 * @Author: ziqi jhzq12345678
 * @Date: 2025-01-17 18:26:07
 * @LastEditors: ziqi jhzq12345678
 * @LastEditTime: 2025-01-21 14:41:45
 * @FilePath: /pornhub_app/lib/views/search/result/search_topic_cell.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pornhub_app/components/image_view.dart';
import 'package:pornhub_app/components/keyword_color/keyword_color.dart';
import 'package:pornhub_app/model/community/community_topic_model.dart';
import 'package:pornhub_app/routes/routes.dart';
import 'package:pornhub_app/utils/color.dart';
import 'package:pornhub_app/utils/extension.dart';
import 'package:pornhub_app/views/search/search_controller.dart';

class SearchTopicCell extends StatelessWidget {
  final CommunityTopicModel model;
  const SearchTopicCell({super.key, required this.model});

  @override
  Widget build(BuildContext context) {
    final searchvc = Get.find<SearchPageController>();
    return Row(
      children: [
        Container(
          width: 60.w,
          height: 60.w,
          clipBehavior: Clip.hardEdge,
          decoration: BoxDecoration(borderRadius: BorderRadius.circular(4.w)),
          child: ImageView(src: model.logo ?? ''),
        ),
        SizedBox(
          width: 5.w,
        ),
        Expanded(
            child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            KeywordColor(
              title: model.name ?? '',
              keyWord: searchvc.keyWord.value,
              style: TextStyle(
                fontSize: 14.w,
                color: Colors.white,
              ),
              kstyle: TextStyle(
                color: COLOR.playerThemColor,
                fontSize: 14.w,
              ),
            ),
            SizedBox(
              height: 2.w,
            ),
            Text(
              model.introduction ?? '',
              maxLines: 1,
              overflow: TextOverflow.ellipsis,
              style:
                  TextStyle(fontSize: 10.w, color: COLOR.hexColor('#A4A4B2')),
            ),
            Text(
              '${model.participate}成员',
              style:
                  TextStyle(fontSize: 10.w, color: COLOR.hexColor('#A4A4B2')),
            )
          ],
        ))
      ],
    ).onOpaqueTap(() {
      // Get.toTopicDetail(id: model.id!);
    });
  }
}
